<script setup lang="ts">
// import Carousel from '@/components/Carousel.vue';
import ScrollVue from '@/components/Scroll.vue';
import filmItem from '@/components/page/film.vue';
import { toRefs, reactive, onMounted, watch } from 'vue';
const props = defineProps({
  list: {
    type: Array,
    default: [] as Array<Record<string, any>>
  },
})
const { list } = toRefs(props)
const state = reactive({
  info: {} as any,
  list: [
    {
      path: 'video?id=154',
      src: 'https://img.cctvch.cn/uploads/202205/2820/6292161b3b6e4224435.png',
      title: '《追寻-红色家书》',
      one: '庆祝中国共产党建党100周年',
      two: '大音巧叙事，深情扣心弦',
      desc: '为庆祝中国共产党建党一百周年，由中央广播电视总台文艺之声、阅读之声共同推出的特别节目《追寻——红色家书背后的故事》， 于2021年4月9日起隆重上线。中视财华国际传媒作为该节目的总视觉设计方以及总后期制作方，深度参与节目的策划与制作。节目播出至今，收获了良好的反响，微博双话题阅读量近6亿、在央视新闻、央视频、云听、央广网、央视网、央视文艺等平台覆盖用户达2.5亿人次，全国各地大量学校、基层党组织受节目影响，积极开展相关主题活动，影响范围仍在不断扩大。已上线共计100期家书音频，推出了10个记录短片，48张海报（其中26个短视频海报），覆盖多种媒体形式，可听可视化的呈现大大加大了红色文化的传播范围和传播深度。',
    }
  ],
  list2: [] as any,
  index: 0
})
onMounted(() => {
  state.list2 = list.value
})
watch(list, (val: any) => {
  state.list2 = val
})
const handlChange = (num: number) => {
  state.index = num
}
</script>

<template>
  <div class="container">
    <div class="film-wrapper">
      <div class="top flex flex-shrink">
        <div class="left">
          <ScrollVue :list="state.list" :margin="0" @change="handlChange"></ScrollVue>
        </div>
        <div class="right flex-1">
          <div class="item" :class="[state.index === index && 'show']" v-for="(item, index) in state.list" :key="index">
            <div class="info">
              <div class="title text-main">{{ item.title }}</div>
              <div class="subtitle text-body font">{{ item.one }}</div>
              <div class="desc text-muted font-sm">{{ item.two }}</div>
            </div>
            <div class="btn-wrap">
              <router-link class="color-bg btn flex-center" :to="'/' + item?.path">点击观看
              </router-link>
            </div>
            <div class="abstract">
              <div class="title font-m">项目简介</div>
              <div class="desc font-sm line-3">
                {{ item.desc }}
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="bot flex flex-wrap">
        <filmItem v-for="(item, index) in state.list2" :key="index" :item="item"></filmItem>
      </div>
    </div>
  </div>
</template>

<style lang="scss" scoped>
.film-wrapper {
  padding-top: 55px;

  .top {
    margin-bottom: 44px;

    .left {
      width: 890px;
      height: 510px;
      margin-right: 80px;
      border: 4px solid #000000;
      box-shadow: 0px 22px 56px 14px rgba(98, 102, 117, 0.35);
      border-radius: 12px;
      overflow: hidden;
    }

    .right {
      position: relative;

      .item {
        position: absolute;
        left: 0;
        top: 0;
        right: 0;
        bottom: 0;
        opacity: 0;
        background-color: #fff;

        &.show {
          transition: .36s ease-in;
          opacity: 1;
        }
      }

      .info {
        .title {
          font-size: 30px;
          line-height: 44px;
        }

        .subtitle {
          padding: 20px 0 30px;
        }
      }

      .btn-wrap {
        margin-top: 35px;
        padding-bottom: 35px;
        border-bottom: solid 1px #9195A3;
        margin-bottom: 40px;

        .btn {
          &:hover {
            box-shadow: 0 5px 20px 0 rgb(0, 0, 0, 0.2);
          }
        }
      }

      .btn {
        height: 58px;
        color: #fff;
        border-radius: 12px;
        cursor: pointer;
      }

      .abstract {
        .desc {
          margin: 20px 0 25px;
          line-height: 20px;
        }
      }
    }
  }
}
</style>
